package com.flink.datastreamapi.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;

public class CollectionSourceDemo {

    public static void main(String[] args) throws Exception {

        //获取执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        //读取数据源--集合
        DataStreamSource<String> collectionSource = env.fromCollection(Arrays.asList("李白", "杜甫", "孟浩然"));


        //输出
        collectionSource.print();

        //执行
        env.execute();


    }
}
